/*
 * Copyright 2011 CyberSMS.ru
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ru.cybersms.model.response;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import ru.cybersms.model.obj.Contact;
import ru.cybersms.model.response.TagsResponse.TagItem;

/**
 *
 * @author Андрей Шерцингер <support@cybersms.ru>
 */
public class ContactsResponse extends Response {

	private List<ContactItem> contacts;

	public List<ContactItem> getContacts() {
		return contacts;
	}

	public void setContacts(List<ContactItem> contacts) {
		this.contacts = contacts;
	}

	public static class ContactItem {

		private int id;
		private String phone;
		private String first_name;
		private String last_name;
		private String patronymic;
		private Date birth_date;
		private String description;
		private String param1;
		private String param2;
		private Date created_at;
		private Date updated_at;
		private List<TagsResponse.TagItem> Tags;

		public Contact getContact() {
			Contact c = new Contact();
			c.setId(id);
			c.setPhone(phone);
			c.setFirstName(first_name);
			c.setLastName(last_name);
			c.setSecondName(patronymic);
			c.setBirthDay(birth_date);
			c.setDescription(description);
			c.setParam1(param1);
			c.setParam2(param2);
			if (Tags != null) {
				List<Integer> tags = new ArrayList<Integer>();
				for (TagsResponse.TagItem t : Tags) {
					tags.add(t.getId());
				}
				c.setTags(tags);
			}
			return c;
		}

		public int getId() {
			return id;
		}

		public void setId(int id) {
			this.id = id;
		}

		public String getPhone() {
			return phone;
		}

		public void setPhone(String phone) {
			this.phone = phone;
		}

		public String getFirst_name() {
			return first_name;
		}

		public void setFirst_name(String first_name) {
			this.first_name = first_name;
		}

		public String getLast_name() {
			return last_name;
		}

		public void setLast_name(String last_name) {
			this.last_name = last_name;
		}

		public String getPatronymic() {
			return patronymic;
		}

		public void setPatronymic(String patronymic) {
			this.patronymic = patronymic;
		}

		public Date getBirth_date() {
			return birth_date;
		}

		public void setBirth_date(Date birth_date) {
			this.birth_date = birth_date;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public String getParam1() {
			return param1;
		}

		public void setParam1(String param1) {
			this.param1 = param1;
		}

		public String getParam2() {
			return param2;
		}

		public void setParam2(String param2) {
			this.param2 = param2;
		}

		public Date getCreated_at() {
			return created_at;
		}

		public void setCreated_at(Date created_at) {
			this.created_at = created_at;
		}

		public Date getUpdated_at() {
			return updated_at;
		}

		public void setUpdated_at(Date updated_at) {
			this.updated_at = updated_at;
		}

		public List<TagItem> getTags() {
			return Tags;
		}

		public void setTags(List<TagItem> Tags) {
			this.Tags = Tags;
		}

		@Override
		public String toString() {
			return "ContactItem{" + "id=" + id + ", phone=" + phone + ", first_name=" + first_name + ", last_name=" + last_name + ", patronymic=" + patronymic + ", birth_date=" + birth_date + ", description=" + description + ", param1=" + param1 + ", param2=" + param2 + ", created_at=" + created_at + ", updated_at=" + updated_at + ", Tags=" + Tags + '}';
		}
	}
}
